package com.hz.ruoyiequipment.data.controller;

import com.hz.ruoyiequipment.data.domain.AgrEquipment;
import com.hz.ruoyiequipment.data.domain.vo.EquipmentWarningSelectVo;
import com.hz.ruoyiequipment.data.service.AgrEquipmentService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.ruoyi.common.core.utils.PageUtils.startPage;

/**
 * @Author: zjk
 * @Date: 2025/3/10 9:28
 * @Description: agr_equipment  List
 */

@RestController
@RequestMapping("/equipmentBase")
public class AgrEquipmentController {
    @Autowired
    private AgrEquipmentService agrEquipmentService;

    /**
     * 查询设备列表
     */
    @RequiresPermissions("system:equipment:list")
    @GetMapping("/list")
    public AjaxResult list(AgrEquipment agrEquipment)
    {
        List<AgrEquipment> list = agrEquipmentService.selectAgrEquipmentList(agrEquipment);
        return AjaxResult.success(list);
    }
    /**
     * @param
     * @return: java.util.List<com.hz.ruoyiequipment.data.domain.AgrEquipment>
     * @Author: zjk
     * @Date: 2025/3/11 9:13
     * @Description: 执行设备列表   by  equipment_types数组
     */
    @RequiresPermissions("system:equipment:list")
    @GetMapping("/listTarget")
    public List<EquipmentWarningSelectVo> selectAgrEquipmentListByTypes(){
        String[] equipmentTypes=new String[]{"环境调控","水肥一体机"};
        return agrEquipmentService.selectAgrEquipmentListByTypes(equipmentTypes);
    }
    /**
     * @param
     * @return: com.ruoyi.common.core.web.domain.AjaxResult
     * @Author: zjk
     * @Date: 2025/3/15 9:54
     * @Description: 首页设备数量信息
     */

    @RequiresPermissions("system:equipment:list")
    @GetMapping("/getFirstPageEq")
    public AjaxResult getFirstPageEq(){
        return AjaxResult.success(agrEquipmentService.getFirstPageEq());
    }

}
